home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Grafik & Text / OzTeX3.0 / BibTeX / BibTeX inputs / abstract.bst < prev    next >
Text File  |  1996-02-11  |  25KB  |  1,344 lines

  1.  
  2. % BibTeX bibliography style `abstract' by David Kotz
  3. %    modifed from
  4. % BibTeX standard bibliography style `alpha'
  5.         % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  6.         % Copyright (C) 1985, all rights reserved.
  7.         % Copying of this file is authorized only if either
  8.         % (1) you make absolutely no changes to your copy, including name, or
  9.         % (2) if you do make changes, you name it something other than
  10.         % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
  11.         % This restriction helps ensure that all standard styles are identical.
  12.         % The file btxbst.doc has the documentation for this style.
  13.  
  14. % DFK added abstract, comment, keyword
  15. ENTRY
  16.   { abstract
  17.     address
  18.     author
  19.     booktitle
  20.     chapter
  21.     comment
  22.     edition
  23.     editor
  24.     howpublished
  25.     institution
  26.     journal
  27.     key
  28.     keyword
  29.     month
  30.     note
  31.     number
  32.     organization
  33.     pages
  34.     publisher
  35.     school
  36.     series
  37.     title
  38.     type
  39.     volume
  40.     year
  41.   }
  42.   {}
  43.   { label extra.label sort.label }
  44.  
  45. % DFK added after.quote to signify end of something not needing period
  46. INTEGERS { output.state before.all mid.sentence after.sentence after.block afte
  47. r.quote}
  48.  
  49. % DFk added after.quote
  50. FUNCTION {init.state.consts}
  51. { #0 'before.all :=
  52.   #1 'mid.sentence :=
  53.   #2 'after.sentence :=
  54.   #3 'after.block :=
  55.   #4 'after.quote :=
  56. }
  57.  
  58. STRINGS { s t }
  59.  
  60. % DFK added after.quote handling so no period is printed after quotes
  61. FUNCTION {output.nonnull}
  62. { 's :=
  63.   output.state after.quote =
  64.     { write$
  65.       newline$
  66.       "\newblock " write$
  67.     }
  68.   { output.state mid.sentence =
  69.     { ", " * write$ }
  70.     { output.state after.block =
  71.         { add.period$ write$
  72.           newline$
  73.           "\newblock " write$
  74.         }
  75.         { output.state before.all =
  76.              'write$
  77.              { add.period$ " " * write$ }
  78.             if$
  79.         }
  80.       if$
  81.       mid.sentence 'output.state :=
  82.     }
  83.   if$
  84.   }
  85.   if$
  86.   s
  87. }
  88.  
  89. FUNCTION {output}
  90. { duplicate$ empty$
  91.     'pop$
  92.     'output.nonnull
  93.   if$
  94. }
  95.  
  96. % DFK added, variant of output
  97. FUNCTION {output.quote}
  98. { duplicate$ empty$
  99.     'pop$
  100.     { output.nonnull
  101.          after.quote 'output.state :=}
  102.   if$
  103. }
  104.  
  105. FUNCTION {output.check}
  106. { 't :=
  107.   duplicate$ empty$
  108.     { pop$ "empty " t * " in " * cite$ * warning$ }
  109.     'output.nonnull
  110.   if$
  111. }
  112.  
  113. % DFK changed to use cite$ for the label
  114. FUNCTION {output.bibitem}
  115. { newline$
  116.   "\bibitem[" write$
  117.   cite$ write$
  118.   "]{" write$
  119.   cite$ write$
  120.   "}" write$
  121.   newline$
  122.   ""
  123.   before.all 'output.state :=
  124. }
  125.  
  126. % DFK changed to not put period when after.quote
  127. FUNCTION {fin.entry}
  128. { output.state after.quote =
  129.    'skip$
  130.    'add.period$
  131.   if$
  132.   write$
  133.   newline$
  134. }
  135.  
  136. FUNCTION {new.block}
  137. { output.state before.all =
  138.     'skip$
  139.     { after.block 'output.state := }
  140.   if$
  141. }
  142.  
  143. FUNCTION {new.sentence}
  144. { output.state after.block =
  145.     'skip$
  146.     { output.state before.all =
  147.         'skip$
  148.         { after.sentence 'output.state := }
  149.       if$
  150.     }
  151.   if$
  152. }
  153.  
  154. FUNCTION {not}
  155. {   { #0 }
  156.     { #1 }
  157.   if$
  158. }
  159.  
  160. FUNCTION {and}
  161. {   'skip$
  162.     { pop$ #0 }
  163.   if$
  164. }
  165.  
  166. FUNCTION {or}
  167. {   { pop$ #1 }
  168.     'skip$
  169.   if$
  170. }
  171.  
  172. FUNCTION {new.block.checka}
  173. { empty$
  174.     'skip$
  175.     'new.block
  176.   if$
  177. }
  178.  
  179. FUNCTION {new.block.checkb}
  180. { empty$
  181.   swap$ empty$
  182.   and
  183.     'skip$
  184.     'new.block
  185.   if$
  186. }
  187.  
  188. FUNCTION {new.sentence.checka}
  189. { empty$
  190.     'skip$
  191.     'new.sentence
  192.   if$
  193. }
  194.  
  195. FUNCTION {new.sentence.checkb}
  196. { empty$
  197.   swap$ empty$
  198.   and
  199.     'skip$
  200.     'new.sentence
  201.   if$
  202. }
  203.  
  204. FUNCTION {field.or.null}
  205. { duplicate$ empty$
  206.     { pop$ "" }
  207.     'skip$
  208.   if$
  209. }
  210.  
  211. FUNCTION {emphasize}
  212. { duplicate$ empty$
  213.     { pop$ "" }
  214.     { "{\em " swap$ * "}" * }
  215.   if$
  216. }
  217.  
  218. INTEGERS { nameptr namesleft numnames }
  219.  
  220. FUNCTION {format.names}
  221. { 's :=
  222.   #1 'nameptr :=
  223.   s num.names$ 'numnames :=
  224.   numnames 'namesleft :=
  225.     { namesleft #0 > }
  226.     { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
  227.       nameptr #1 >
  228.         { namesleft #1 >
  229.             { ", " * t * }
  230.             { numnames #2 >
  231.                 { "," * }
  232.                 'skip$
  233.               if$
  234.               t "others" =
  235.                 { " et~al." * }
  236.                 { " and " * t * }
  237.               if$
  238.             }
  239.           if$
  240.         }
  241.         't
  242.       if$
  243.       nameptr #1 + 'nameptr :=
  244.       namesleft #1 - 'namesleft :=
  245.     }
  246.   while$
  247. }
  248.  
  249. FUNCTION {format.authors}
  250. { author empty$
  251.     { "" }
  252.     { author format.names }
  253.   if$
  254. }
  255.  
  256. FUNCTION {format.editors}
  257. { editor empty$
  258.     { "" }
  259.     { editor format.names
  260.       editor num.names$ #1 >
  261.         { ", editors" * }
  262.         { ", editor" * }
  263.       if$
  264.     }
  265.   if$
  266. }
  267.  
  268. FUNCTION {format.title}
  269. { title empty$
  270.     { "" }
  271.     { title "t" change.case$ }
  272.   if$
  273. }
  274.  
  275. FUNCTION {n.dashify}
  276. { 't :=
  277.   ""
  278.     { t empty$ not }
  279.     { t #1 #1 substring$ "-" =
  280.         { t #1 #2 substring$ "--" = not
  281.             { "--" *
  282.               t #2 global.max$ substring$ 't :=
  283.             }
  284.             {   { t #1 #1 substring$ "-" = }
  285.                 { "-" *
  286.                   t #2 global.max$ substring$ 't :=
  287.                 }
  288.               while$
  289.             }
  290.           if$
  291.         }
  292.         { t #1 #1 substring$ *
  293.           t #2 global.max$ substring$ 't :=
  294.         }
  295.       if$
  296.     }
  297.   while$
  298. }
  299.  
  300. FUNCTION {format.date}
  301. { year empty$
  302.     { month empty$
  303.         { "" }
  304.         { "there's a month but no year in " cite$ * warning$
  305.           month
  306.         }
  307.       if$
  308.     }
  309.     { month empty$
  310.         'year
  311.         { month " " * year * }
  312.       if$
  313.     }
  314.   if$
  315. }
  316.  
  317. FUNCTION {format.btitle}
  318. { title emphasize
  319. }
  320.  
  321. FUNCTION {tie.or.space.connect}
  322. { duplicate$ text.length$ #3 <
  323.     { "~" }
  324.     { " " }
  325.   if$
  326.   swap$ * *
  327. }
  328.  
  329. FUNCTION {either.or.check}
  330. { empty$
  331.     'pop$
  332.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  333.   if$
  334. }
  335.  
  336. FUNCTION {format.bvolume}
  337. { volume empty$
  338.     { "" }
  339.     { "volume" volume tie.or.space.connect
  340.       series empty$
  341.         'skip$
  342.         { " of " * series emphasize * }
  343.       if$
  344.       "volume and number" number either.or.check
  345.     }
  346.   if$
  347. }
  348.  
  349. FUNCTION {format.number.series}
  350. { volume empty$
  351.     { number empty$
  352.         { series field.or.null }
  353.         { output.state mid.sentence =
  354.             { "number" }
  355.             { "Number" }
  356.           if$
  357.           number tie.or.space.connect
  358.           series empty$
  359.             { "there's a number but no series in " cite$ * warning$ }
  360.             { " in " * series * }
  361.           if$
  362.         }
  363.       if$
  364.     }
  365.     { "" }
  366.   if$
  367. }
  368.  
  369. FUNCTION {format.edition}
  370. { edition empty$
  371.     { "" }
  372.     { output.state mid.sentence =
  373.         { edition "l" change.case$ " edition" * }
  374.         { edition "t" change.case$ " edition" * }
  375.       if$
  376.     }
  377.   if$
  378. }
  379.  
  380. INTEGERS { multiresult }
  381.  
  382. FUNCTION {multi.page.check}
  383. { 't :=
  384.   #0 'multiresult :=
  385.     { multiresult not
  386.       t empty$ not
  387.       and
  388.     }
  389.     { t #1 #1 substring$
  390.       duplicate$ "-" =
  391.       swap$ duplicate$ "," =
  392.       swap$ "+" =
  393.       or or
  394.         { #1 'multiresult := }
  395.         { t #2 global.max$ substring$ 't := }
  396.       if$
  397.     }
  398.   while$
  399.   multiresult
  400. }
  401.  
  402. FUNCTION {format.pages}
  403. { pages empty$
  404.     { "" }
  405.     { pages multi.page.check
  406.         { "pages" pages n.dashify tie.or.space.connect }
  407.         { "page" pages tie.or.space.connect }
  408.       if$
  409.     }
  410.   if$
  411. }
  412.  
  413. FUNCTION {format.vol.num.pages}
  414. { volume field.or.null
  415.   number empty$
  416.     'skip$
  417.     { "(" number * ")" * *
  418.       volume empty$
  419.         { "there's a number but no volume in " cite$ * warning$ }
  420.         'skip$
  421.       if$
  422.     }
  423.   if$
  424.   pages empty$
  425.     'skip$
  426.     { duplicate$ empty$
  427.         { pop$ format.pages }
  428.         { ":" * pages n.dashify * }
  429.       if$
  430.     }
  431.   if$
  432. }
  433.  
  434. FUNCTION {format.chapter.pages}
  435. { chapter empty$
  436.     'format.pages
  437.     { type empty$
  438.         { "chapter" }
  439.         { type "l" change.case$ }
  440.       if$
  441.       chapter tie.or.space.connect
  442.       pages empty$
  443.         'skip$
  444.         { ", " * format.pages * }
  445.       if$
  446.     }
  447.   if$
  448. }
  449.  
  450. FUNCTION {format.in.ed.booktitle}
  451. { booktitle empty$
  452.     { "" }
  453.     { editor empty$
  454.         { "In " booktitle emphasize * }
  455.         { "In " format.editors * ", " * booktitle emphasize * }
  456.       if$
  457.     }
  458.   if$
  459. }
  460.  
  461. FUNCTION {empty.misc.check}
  462. { author empty$ title empty$ howpublished empty$
  463.   month empty$ year empty$ note empty$
  464.   and and and and and
  465.   key empty$ not and
  466.     { "all relevant fields are empty in " cite$ * warning$ }
  467.     'skip$
  468.   if$
  469. }
  470.  
  471. FUNCTION {format.thesis.type}
  472. { type empty$
  473.     'skip$
  474.     { pop$
  475.       type "t" change.case$
  476.     }
  477.   if$
  478. }
  479.  
  480. FUNCTION {format.tr.number}
  481. { type empty$
  482.     { "Technical Report" }
  483.     'type
  484.   if$
  485.   number empty$
  486.     { "t" change.case$ }
  487.     { number tie.or.space.connect }
  488.   if$
  489. }
  490.  
  491. FUNCTION {format.article.crossref}
  492. { key empty$
  493.     { journal empty$
  494.         { "need key or journal for " cite$ * " to crossref " * crossref *
  495.           warning$
  496.           ""
  497.         }
  498.         { "In {\em " journal * "\/}" * }
  499.       if$
  500.     }
  501.     { "In " key * }
  502.   if$
  503.   " \cite{" * crossref * "}" *
  504. }
  505.  
  506. FUNCTION {format.crossref.editor}
  507. { editor #1 "{vv~}{ll}" format.name$
  508.   editor num.names$ duplicate$
  509.   #2 >
  510.     { pop$ " et~al." * }
  511.     { #2 <
  512.         'skip$
  513.         { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  514.             { " et~al." * }
  515.             { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  516.           if$
  517.         }
  518.       if$
  519.     }
  520.   if$
  521. }
  522.  
  523. FUNCTION {format.book.crossref}
  524. { volume empty$
  525.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  526.       "In "
  527.     }
  528.     { "Volume" volume tie.or.space.connect
  529.       " of " *
  530.     }
  531.   if$
  532.   editor empty$
  533.   editor field.or.null author field.or.null =
  534.   or
  535.     { key empty$
  536.         { series empty$
  537.             { "need editor, key, or series for " cite$ * " to crossref " *
  538.               crossref * warning$
  539.               "" *
  540.             }
  541.             { "{\em " * series * "\/}" * }
  542.           if$
  543.         }
  544.         { key * }
  545.       if$
  546.     }
  547.     { format.crossref.editor * }
  548.   if$
  549.   " \cite{" * crossref * "}" *
  550. }
  551.  
  552. FUNCTION {format.incoll.inproc.crossref}
  553. { editor empty$
  554.   editor field.or.null author field.or.null =
  555.   or
  556.     { key empty$
  557.         { booktitle empty$
  558.             { "need editor, key, or booktitle for " cite$ * " to crossref " *
  559.               crossref * warning$
  560.               ""
  561.             }
  562.             { "In {\em " booktitle * "\/}" * }
  563.           if$
  564.         }
  565.         { "In " key * }
  566.       if$
  567.     }
  568.     { "In " format.crossref.editor * }
  569.   if$
  570.   " \cite{" * crossref * "}" *
  571. }
  572.  
  573. % DFK added
  574. FUNCTION {format.abstract}
  575. { abstract empty$
  576.     { "" }
  577.     { "\begin{quote} {\bf Abstract:} " abstract * " \end{quote}" *}
  578.   if$
  579. }
  580.  
  581. % DFK added
  582. FUNCTION {format.keyword}
  583. { keyword empty$
  584.     { "" }
  585.     { "\begin{quote} {\bf Keyword:} " keyword * " \end{quote}" *}
  586.   if$
  587. }
  588.  
  589. % DFK added
  590. FUNCTION {format.comment}
  591. { comment empty$
  592.     { "" }
  593.     { "\begin{quote} {\bf Comment:} " comment * " \end{quote}" *}
  594.   if$
  595. }
  596.  
  597. % DFK added
  598. FUNCTION {dfk.stuff}
  599. { new.block
  600.   format.abstract output.quote
  601. %  new.block
  602.   format.keyword output.quote
  603. %  new.block
  604.   format.comment output.quote
  605. }
  606.  
  607. % DFK: added a call to dfk.stuff in all entry-type functions below
  608.  
  609. FUNCTION {article}
  610. { output.bibitem
  611.   format.authors "author" output.check
  612.   new.block
  613.   format.title "title" output.check
  614.   new.block
  615.   crossref missing$
  616.     { journal emphasize "journal" output.check
  617.       format.vol.num.pages output
  618.       format.date "year" output.check
  619.     }
  620.     { format.article.crossref output.nonnull
  621.       format.pages output
  622.     }
  623.   if$
  624.   new.block
  625.   note output
  626.   dfk.stuff
  627.   fin.entry
  628. }
  629.  
  630. FUNCTION {book}
  631. { output.bibitem
  632.   author empty$
  633.     { format.editors "author and editor" output.check }
  634.     { format.authors output.nonnull
  635.       crossref missing$
  636.         { "author and editor" editor either.or.check }
  637.         'skip$
  638.       if$
  639.     }
  640.   if$
  641.   new.block
  642.   format.btitle "title" output.check
  643.   crossref missing$
  644.     { format.bvolume output
  645.       new.block
  646.       format.number.series output
  647.       new.sentence
  648.       publisher "publisher" output.check
  649.       address output
  650.     }
  651.     { new.block
  652.       format.book.crossref output.nonnull
  653.     }
  654.   if$
  655.   format.edition output
  656.   format.date "year" output.check
  657.   new.block
  658.   note output
  659.   dfk.stuff
  660.   fin.entry
  661. }
  662.  
  663. FUNCTION {booklet}
  664. { output.bibitem
  665.   format.authors output
  666.   new.block
  667.   format.title "title" output.check
  668.   howpublished address new.block.checkb
  669.   howpublished output
  670.   address output
  671.   format.date output
  672.   new.block
  673.   note output
  674.   dfk.stuff
  675.   fin.entry
  676. }
  677.  
  678. FUNCTION {inbook}
  679. { output.bibitem
  680.   author empty$
  681.     { format.editors "author and editor" output.check }
  682.     { format.authors output.nonnull
  683.       crossref missing$
  684.         { "author and editor" editor either.or.check }
  685.         'skip$
  686.       if$
  687.     }
  688.   if$
  689.   new.block
  690.   format.btitle "title" output.check
  691.   crossref missing$
  692.     { format.bvolume output
  693.       format.chapter.pages "chapter and pages" output.check
  694.       new.block
  695.       format.number.series output
  696.       new.sentence
  697.       publisher "publisher" output.check
  698.       address output
  699.     }
  700.     { format.chapter.pages "chapter and pages" output.check
  701.       new.block
  702.       format.book.crossref output.nonnull
  703.     }
  704.   if$
  705.   format.edition output
  706.   format.date "year" output.check
  707.   new.block
  708.   note output
  709.   dfk.stuff
  710.   fin.entry
  711. }
  712.  
  713. FUNCTION {incollection}
  714. { output.bibitem
  715.   format.authors "author" output.check
  716.   new.block
  717.   format.title "title" output.check
  718.   new.block
  719.   crossref missing$
  720.     { format.in.ed.booktitle "booktitle" output.check
  721.       format.bvolume output
  722.       format.number.series output
  723.       format.chapter.pages output
  724.       new.sentence
  725.       publisher "publisher" output.check
  726.       address output
  727.       format.edition output
  728.       format.date "year" output.check
  729.     }
  730.     { format.incoll.inproc.crossref output.nonnull
  731.       format.chapter.pages output
  732.     }
  733.   if$
  734.   new.block
  735.   note output
  736.   dfk.stuff
  737.   fin.entry
  738. }
  739.  
  740. FUNCTION {inproceedings}
  741. { output.bibitem
  742.   format.authors "author" output.check
  743.   new.block
  744.   format.title "title" output.check
  745.   new.block
  746.   crossref missing$
  747.     { format.in.ed.booktitle "booktitle" output.check
  748.       format.bvolume output
  749.       format.number.series output
  750.       format.pages output
  751.       address empty$
  752.         { organization publisher new.sentence.checkb
  753.           organization output
  754.           publisher output
  755.           format.date "year" output.check
  756.         }
  757.         { address output.nonnull
  758.           format.date "year" output.check
  759.           new.sentence
  760.           organization output
  761.           publisher output
  762.         }
  763.       if$
  764.     }
  765.     { format.incoll.inproc.crossref output.nonnull
  766.       format.pages output
  767.     }
  768.   if$
  769.   new.block
  770.   note output
  771.   dfk.stuff
  772.   fin.entry
  773. }
  774.  
  775. FUNCTION {conference} { inproceedings }
  776.  
  777. FUNCTION {manual}
  778. { output.bibitem
  779.   author empty$
  780.     { organization empty$
  781.         'skip$
  782.         { organization output.nonnull
  783.           address output
  784.         }
  785.       if$
  786.     }
  787.     { format.authors output.nonnull }
  788.   if$
  789.   new.block
  790.   format.btitle "title" output.check
  791.   author empty$
  792.     { organization empty$
  793.         { address new.block.checka
  794.           address output
  795.         }
  796.         'skip$
  797.       if$
  798.     }
  799.     { organization address new.block.checkb
  800.       organization output
  801.       address output
  802.     }
  803.   if$
  804.   format.edition output
  805.   format.date output
  806.   new.block
  807.   note output
  808.   dfk.stuff
  809.   fin.entry
  810. }
  811.  
  812. FUNCTION {mastersthesis}
  813. { output.bibitem
  814.   format.authors "author" output.check
  815.   new.block
  816.   format.title "title" output.check
  817.   new.block
  818.   "Master's thesis" format.thesis.type output.nonnull
  819.   school "school" output.check
  820.   address output
  821.   format.date "year" output.check
  822.   new.block
  823.   note output
  824.   dfk.stuff
  825.   fin.entry
  826. }
  827.  
  828. FUNCTION {misc}
  829. { output.bibitem
  830.   format.authors output
  831.   title howpublished new.block.checkb
  832.   format.title output
  833.   howpublished new.block.checka
  834.   howpublished output
  835.   format.date output
  836.   new.block
  837.   note output
  838.   dfk.stuff
  839.   fin.entry
  840.   empty.misc.check
  841. }
  842.  
  843. FUNCTION {phdthesis}
  844. { output.bibitem
  845.   format.authors "author" output.check
  846.   new.block
  847.   format.btitle "title" output.check
  848.   new.block
  849.   "PhD thesis" format.thesis.type output.nonnull
  850.   school "school" output.check
  851.   address output
  852.   format.date "year" output.check
  853.   new.block
  854.   note output
  855.   dfk.stuff
  856.   fin.entry
  857. }
  858.  
  859. FUNCTION {proceedings}
  860. { output.bibitem
  861.   editor empty$
  862.     { organization output }
  863.     { format.editors output.nonnull }
  864.   if$
  865.   new.block
  866.   format.btitle "title" output.check
  867.   format.bvolume output
  868.   format.number.series output
  869.   address empty$
  870.     { editor empty$
  871.         { publisher new.sentence.checka }
  872.         { organization publisher new.sentence.checkb
  873.           organization output
  874.         }
  875.       if$
  876.       publisher output
  877.       format.date "year" output.check
  878.     }
  879.     { address output.nonnull
  880.       format.date "year" output.check
  881.       new.sentence
  882.       editor empty$
  883.         'skip$
  884.         { organization output }
  885.       if$
  886.       publisher output
  887.     }
  888.   if$
  889.   new.block
  890.   note output
  891.   dfk.stuff
  892.   fin.entry
  893. }
  894.  
  895. FUNCTION {techreport}
  896. { output.bibitem
  897.   format.authors "author" output.check
  898.   new.block
  899.   format.title "title" output.check
  900.   new.block
  901.   format.tr.number output.nonnull
  902.   institution "institution" output.check
  903.   address output
  904.   format.date "year" output.check
  905.   new.block
  906.   note output
  907.   dfk.stuff
  908.   fin.entry
  909. }
  910.  
  911. FUNCTION {unpublished}
  912. { output.bibitem
  913.   format.authors "author" output.check
  914.   new.block
  915.   format.title "title" output.check
  916.   new.block
  917.   note "note" output.check
  918.   format.date output
  919.   dfk.stuff
  920.   fin.entry
  921. }
  922.  
  923. FUNCTION {default.type} { misc }
  924.  
  925. MACRO {jan} {"January"}
  926.  
  927. MACRO {feb} {"February"}
  928.  
  929. MACRO {mar} {"March"}
  930.  
  931. MACRO {apr} {"April"}
  932.  
  933. MACRO {may} {"May"}
  934.  
  935. MACRO {jun} {"June"}
  936.  
  937. MACRO {jul} {"July"}
  938.  
  939. MACRO {aug} {"August"}
  940.  
  941. MACRO {sep} {"September"}
  942.  
  943. MACRO {oct} {"October"}
  944.  
  945. MACRO {nov} {"November"}
  946.  
  947. MACRO {dec} {"December"}
  948.  
  949. MACRO {acmcs} {"ACM Computing Surveys"}
  950.  
  951. MACRO {acta} {"Acta Informatica"}
  952.  
  953. MACRO {cacm} {"Communications of the ACM"}
  954.  
  955. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  956.  
  957. MACRO {ibmsj} {"IBM Systems Journal"}
  958.  
  959. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  960.  
  961. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  962.  
  963. MACRO {ieeetcad}
  964.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  965.  
  966. MACRO {ipl} {"Information Processing Letters"}
  967.  
  968. MACRO {jacm} {"Journal of the ACM"}
  969.  
  970. MACRO {jcss} {"Journal of Computer and System Sciences"}
  971.  
  972. MACRO {scp} {"Science of Computer Programming"}
  973.  
  974. MACRO {sicomp} {"SIAM Journal on Computing"}
  975.  
  976. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  977.  
  978. MACRO {tods} {"ACM Transactions on Database Systems"}
  979.  
  980. MACRO {tog} {"ACM Transactions on Graphics"}
  981.  
  982. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  983.  
  984. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  985.  
  986. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  987.  
  988. MACRO {tcs} {"Theoretical Computer Science"}
  989.  
  990. READ
  991.  
  992. FUNCTION {sortify}
  993. { purify$
  994.   "l" change.case$
  995. }
  996.  
  997. INTEGERS { len }
  998.  
  999. FUNCTION {chop.word}
  1000. { 's :=
  1001.   'len :=
  1002.   s #1 len substring$ =
  1003.     { s len #1 + global.max$ substring$ }
  1004.     's
  1005.   if$
  1006. }
  1007.  
  1008. INTEGERS { et.al.char.used }
  1009.  
  1010. FUNCTION {initialize.et.al.char.used}
  1011. { #0 'et.al.char.used :=
  1012. }
  1013.  
  1014. EXECUTE {initialize.et.al.char.used}
  1015.  
  1016. FUNCTION {format.lab.names}
  1017. { 's :=
  1018.   s num.names$ 'numnames :=
  1019.   numnames #1 >
  1020.     { numnames #4 >
  1021.         { #3 'namesleft := }
  1022.         { numnames 'namesleft := }
  1023.       if$
  1024.       #1 'nameptr :=
  1025.       ""
  1026.         { namesleft #0 > }
  1027.         { nameptr numnames =
  1028.             { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1029.                 { "{\etalchar{+}}" *
  1030.                   #1 'et.al.char.used :=
  1031.                 }
  1032.                 { s nameptr "{v{}}{l{}}" format.name$ * }
  1033.               if$
  1034.             }
  1035.             { s nameptr "{v{}}{l{}}" format.name$ * }
  1036.           if$
  1037.           nameptr #1 + 'nameptr :=
  1038.           namesleft #1 - 'namesleft :=
  1039.         }
  1040.       while$
  1041.       numnames #4 >
  1042.         { "{\etalchar{+}}" *
  1043.           #1 'et.al.char.used :=
  1044.         }
  1045.         'skip$
  1046.       if$
  1047.     }
  1048.     { s #1 "{v{}}{l{}}" format.name$
  1049.       duplicate$ text.length$ #2 <
  1050.         { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
  1051.         'skip$
  1052.       if$
  1053.     }
  1054.   if$
  1055. }
  1056.  
  1057. FUNCTION {author.key.label}
  1058. { author empty$
  1059.     { key empty$
  1060.         { cite$ #1 #3 substring$ }
  1061.         { key #3 text.prefix$ }
  1062.       if$
  1063.     }
  1064.     { author format.lab.names }
  1065.   if$
  1066. }
  1067.  
  1068. FUNCTION {author.editor.key.label}
  1069. { author empty$
  1070.     { editor empty$
  1071.         { key empty$
  1072.             { cite$ #1 #3 substring$ }
  1073.             { key #3 text.prefix$ }
  1074.           if$
  1075.         }
  1076.         { editor format.lab.names }
  1077.       if$
  1078.     }
  1079.     { author format.lab.names }
  1080.   if$
  1081. }
  1082.  
  1083. FUNCTION {author.key.organization.label}
  1084. { author empty$
  1085.     { key empty$
  1086.         { organization empty$
  1087.             { cite$ #1 #3 substring$ }
  1088.             { "The " #4 organization chop.word #3 text.prefix$ }
  1089.           if$
  1090.         }
  1091.         { key #3 text.prefix$ }
  1092.       if$
  1093.     }
  1094.     { author format.lab.names }
  1095.   if$
  1096. }
  1097.  
  1098. FUNCTION {editor.key.organization.label}
  1099. { editor empty$
  1100.     { key empty$
  1101.         { organization empty$
  1102.             { cite$ #1 #3 substring$ }
  1103.             { "The " #4 organization chop.word #3 text.prefix$ }
  1104.           if$
  1105.         }
  1106.         { key #3 text.prefix$ }
  1107.       if$
  1108.     }
  1109.     { editor format.lab.names }
  1110.   if$
  1111. }
  1112.  
  1113. FUNCTION {calc.label}
  1114. { type$ "book" =
  1115.   type$ "inbook" =
  1116.   or
  1117.     'author.editor.key.label
  1118.     { type$ "proceedings" =
  1119.         'editor.key.organization.label
  1120.         { type$ "manual" =
  1121.             'author.key.organization.label
  1122.             'author.key.label
  1123.           if$
  1124.         }
  1125.       if$
  1126.     }
  1127.   if$
  1128.   duplicate$
  1129.   year field.or.null purify$ #-1 #2 substring$
  1130.   *
  1131.   'label :=
  1132.   year field.or.null purify$ #-1 #4 substring$
  1133.   *
  1134.   sortify 'sort.label :=
  1135. }
  1136.  
  1137. FUNCTION {sort.format.names}
  1138. { 's :=
  1139.   #1 'nameptr :=
  1140.   ""
  1141.   s num.names$ 'numnames :=
  1142.   numnames 'namesleft :=
  1143.     { namesleft #0 > }
  1144.     { nameptr #1 >
  1145.         { "   " * }
  1146.         'skip$
  1147.       if$
  1148.       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  1149.       nameptr numnames = t "others" = and
  1150.         { "et al" * }
  1151.         { t sortify * }
  1152.       if$
  1153.       nameptr #1 + 'nameptr :=
  1154.       namesleft #1 - 'namesleft :=
  1155.     }
  1156.   while$
  1157. }
  1158.  
  1159. FUNCTION {sort.format.title}
  1160. { 't :=
  1161.   "A " #2
  1162.     "An " #3
  1163.       "The " #4 t chop.word
  1164.     chop.word
  1165.   chop.word
  1166.   sortify
  1167.   #1 global.max$ substring$
  1168. }
  1169.  
  1170. FUNCTION {author.sort}
  1171. { author empty$
  1172.     { key empty$
  1173.         { "to sort, need author or key in " cite$ * warning$
  1174.           ""
  1175.         }
  1176.         { key sortify }
  1177.       if$
  1178.     }
  1179.     { author sort.format.names }
  1180.   if$
  1181. }
  1182.  
  1183. FUNCTION {author.editor.sort}
  1184. { author empty$
  1185.     { editor empty$
  1186.         { key empty$
  1187.             { "to sort, need author, editor, or key in " cite$ * warning$
  1188.               ""
  1189.             }
  1190.             { key sortify }
  1191.           if$
  1192.         }
  1193.         { editor sort.format.names }
  1194.       if$
  1195.     }
  1196.     { author sort.format.names }
  1197.   if$
  1198. }
  1199.  
  1200. FUNCTION {author.organization.sort}
  1201. { author empty$
  1202.     { organization empty$
  1203.         { key empty$
  1204.             { "to sort, need author, organization, or key in " cite$ * warning$
  1205.               ""
  1206.             }
  1207.             { key sortify }
  1208.           if$
  1209.         }
  1210.         { "The " #4 organization chop.word sortify }
  1211.       if$
  1212.     }
  1213.     { author sort.format.names }
  1214.   if$
  1215. }
  1216.  
  1217. FUNCTION {editor.organization.sort}
  1218. { editor empty$
  1219.     { organization empty$
  1220.         { key empty$
  1221.             { "to sort, need editor, organization, or key in " cite$ * warning$
  1222.               ""
  1223.             }
  1224.             { key sortify }
  1225.           if$
  1226.         }
  1227.         { "The " #4 organization chop.word sortify }
  1228.       if$
  1229.     }
  1230.     { editor sort.format.names }
  1231.   if$
  1232. }
  1233.  
  1234. FUNCTION {presort}
  1235. { calc.label
  1236.   sort.label
  1237.   "    "
  1238.   *
  1239.   type$ "book" =
  1240.   type$ "inbook" =
  1241.   or
  1242.     'author.editor.sort
  1243.     { type$ "proceedings" =
  1244.         'editor.organization.sort
  1245.         { type$ "manual" =
  1246.             'author.organization.sort
  1247.             'author.sort
  1248.           if$
  1249.         }
  1250.       if$
  1251.     }
  1252.   if$
  1253.   *
  1254.   "    "
  1255.   *
  1256.   year field.or.null sortify
  1257.   *
  1258.   "    "
  1259.   *
  1260.   title field.or.null
  1261.   sort.format.title
  1262.   *
  1263. % DFK throw away stuff above and use cite$ for sort key
  1264.   pop$
  1265.   cite$
  1266.   #1 entry.max$ substring$
  1267.   'sort.key$ :=
  1268. }
  1269.  
  1270. ITERATE {presort}
  1271.  
  1272. SORT
  1273.  
  1274. STRINGS { longest.label last.sort.label next.extra }
  1275.  
  1276. INTEGERS { longest.label.width last.extra.num }
  1277.  
  1278. FUNCTION {initialize.longest.label}
  1279. { "" 'longest.label :=
  1280.   #0 int.to.chr$ 'last.sort.label :=
  1281.   "" 'next.extra :=
  1282.   #0 'longest.label.width :=
  1283.   #0 'last.extra.num :=
  1284. }
  1285.  
  1286. FUNCTION {forward.pass}
  1287. { last.sort.label sort.label =
  1288.     { last.extra.num #1 + 'last.extra.num :=
  1289.       last.extra.num int.to.chr$ 'extra.label :=
  1290.     }
  1291.     { "a" chr.to.int$ 'last.extra.num :=
  1292.       "" 'extra.label :=
  1293.       sort.label 'last.sort.label :=
  1294.     }
  1295.   if$
  1296. }
  1297.  
  1298. FUNCTION {reverse.pass}
  1299. { next.extra "b" =
  1300.     { "a" 'extra.label := }
  1301.     'skip$
  1302.   if$
  1303.   label extra.label * 'label :=
  1304.   label width$ longest.label.width >
  1305.     { label 'longest.label :=
  1306.       label width$ 'longest.label.width :=
  1307.     }
  1308.     'skip$
  1309.   if$
  1310.   extra.label 'next.extra :=
  1311. }
  1312.  
  1313. EXECUTE {initialize.longest.label}
  1314.  
  1315. ITERATE {forward.pass}
  1316.  
  1317. REVERSE {reverse.pass}
  1318.  
  1319. FUNCTION {begin.bib}
  1320. { et.al.char.used
  1321.     { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
  1322.     'skip$
  1323.   if$
  1324.   preamble$ empty$
  1325.     'skip$
  1326.     { preamble$ write$ newline$ }
  1327.   if$
  1328.   "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  1329. }
  1330.  
  1331. EXECUTE {begin.bib}
  1332.  
  1333. EXECUTE {init.state.consts}
  1334.  
  1335. ITERATE {call.type$}
  1336.  
  1337. FUNCTION {end.bib}
  1338. { newline$
  1339.   "\end{thebibliography}" write$ newline$
  1340. }
  1341.  
  1342. EXECUTE {end.bib}
  1343.  
  1344.